package cn.tedu.eguser1.base.response;

import lombok.Getter;
import lombok.Setter;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class JsonResult {
    private Integer code;
    private String message;
    private Object data;


    public JsonResult(StatesCode statesCode) {
        this.code = statesCode.getCode();
        this.message = statesCode.getMessage();
    }
    public JsonResult(StatesCode statesCode, Object data) {
        this.code = statesCode.getCode();
        this.message = statesCode.getMessage();
        this.data = data;
    }
    public static JsonResult ok(Object data) {
        return new JsonResult(StatesCode.OPERATION_SUCCESS, data);
    }
    public static JsonResult ok() {
        return new JsonResult(StatesCode.OPERATION_SUCCESS);
    }
}
